<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .son {
            justify-content: center;
            width: 100px;
            height: 100px;
            background-color: pink;

        }

        .father {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 200px;
            height: 200px;
            background-color: red;
        }
    </style>
</head>

<body>
    <div class="father">
        <div class="son">儿子</div>
    </div>
    <script>
        var son = document.querySelector('.son')
        son.addEventListener('click', function (e) {
            alert('1')
            e.stopPropagation();  //阻止冒泡
        }, false)

        var father = document.querySelector('.father')
        father.addEventListener('click', function () {
            alert('2')
        }, false)


        document.addEventListener('click', function () {
            alert('3')
        })
    </script>
</body>

</html>